package com.keyancompany.zhongbaopingtai.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.keyancompany.zhongbaopingtai.R;
import com.keyancompany.zhongbaopingtai.model.TeamUser;

import java.util.List;

/**
 * 查询我的团队列表
 */
public class IndexTeamAdapter extends ListAdapter {


    private  List<TeamUser> list;
    public IndexTeamAdapter(Context ctx,List<TeamUser> list) {
        super(ctx);
        this.list = list;
    }

    @Override
    public int getContentViewId() {
        return R.layout.item_team;
    }


    @Override
    public int getCount() {
        return list.size();

    }

    @Override
    public HolderView getHoldView(int position, View contentView, ViewGroup parent) {
        TeamHolder hold = new TeamHolder();
        hold.teamName = (TextView) contentView.findViewById(R.id.team_name);
        return hold;
    }

    @Override
    public void setItemView(int position, HolderView contentView, Object item) {
        TeamHolder hold = (TeamHolder) contentView;
        hold.teamName.setText(list.get(position).getTeamName());
    }


    public class TeamHolder extends HolderView {
        TextView teamName;
    }
}
